package com.lvyq.myplayer.adapter

import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.lvyq.myplayer.model.area.MvAreaBean
import com.lvyq.myplayer.ui.fragment.MvPagerFragment

/**
 * 文件描述：MvPagerAdapter
 * 作者：lvyq
 * 创建时间：2025-02-26
 * 修改时间：2025-02-26
 */
class MvPagerAdapter(val data:MvAreaBean,fm: FragmentManager) : FragmentPagerAdapter(fm) {
    override fun getCount(): Int {
        return data.rows.size
    }

    override fun getItem(position: Int): Fragment {
        val fragment = MvPagerFragment()
        val bundle = Bundle()
        //传值到Fragment
        bundle.putString("code",data.rows.get(position).code)
        fragment.arguments=bundle
        return fragment
    }

    //获取tabLayOut
    override fun getPageTitle(position: Int): CharSequence? {
        return  data.rows.get(position).name
    }
}